import { StateMoal } from "../model/StateMoal";
import { TaskBoardData, TaskBoardList } from "../model/TaskBoardList";
import { TaskData, TaskList, TimeMentionModal } from "../model/TaskList";
import { FieldContentData, FieldIdData, FieldTree } from "../model/fieldTree";
import { LifeModel, LifeModelData } from "../model/lifeModel";
import { Setting } from "../model/setting";
import { StageData, StageList, TaskIdsModal } from "../model/stage";
import { SurfaceSetting } from "../model/surfaceSetting";
import { TimeManage, TimeManageList } from "../model/timeManage";

export const settingInit = new Setting("", "", "用户", 10);

export const surfaceSettingPath = "./data/surfaceSetting.json";
export const surfaceSettingInit = new SurfaceSetting({
  maxId: 100,
  fieldExpandedNames: ["领域", "阶段", "任务", "内容"],
  LifeModelListKey: "",
  LifeModelItemsKey: "",
  FieldTreeKey: "",
  GoalListKey: "",
  StageState: "onGonging",
  showGoal: 10,
  StageListKey: "",
  showLifeModel: 1,
  showField: [9],
  menuKey: "",
  StageLastStartTimeInterval: 1000 * 60 * 60 * 24,
  TaskListKey: 0,
  showStage: [12],
  taskState4Task: "onGonging",
  taskState4Clock: "onGonging",
  taskBoardList: new TaskBoardList([new TaskBoardData("测试", [])]),
  OperationPanelExpandedNames: [],
  toRemoveMediaPath: [],
  memoryChooseTaskResults: [],
  memoryChooseLifeResults: [],
  memoryPanelKey: 0,
  statChooseTaskResults: [],
  statChooseLifeResults: [],
  statChooseTimeRange: "周",
  carouselImg: [
    "https://naive-ui.oss-cn-beijing.aliyuncs.com/carousel-img/carousel1.jpeg",
    "https://naive-ui.oss-cn-beijing.aliyuncs.com/carousel-img/carousel2.jpeg",
    "https://naive-ui.oss-cn-beijing.aliyuncs.com/carousel-img/carousel3.jpeg",
    "https://naive-ui.oss-cn-beijing.aliyuncs.com/carousel-img/carousel4.jpeg",
  ],
  TaskBoardPanelExpandedNames: [],
});
export const lifeModelPath = "./data/lifeModel.json";
export const lifeModelInit = new LifeModel(
  1,
  [1, 4],
  [
    new LifeModelData(1, "第一个生活模式", "第一个生活模式", [2, 3, 5]),
    new LifeModelData(4, "第2个生活模式", "第2个生活模式", []),
  ],
);
export const timeManagePath = "./data/timeManage.json";
export const timeManageInit = new TimeManageList([
  new TimeManage(2, 1688864940000, 1688868540000, "早饭", 1),
  new TimeManage(3, 1688868600000, 1688872200000, "洗漱", 1),
  new TimeManage(5, 1688868600000, 1688872200000, "洗漱2", 1),
]);
export const fieldTreePath = "./data/fieldTree.json";
export const StageIdsInit = () => {
  return new StateMoal([], [], []);
};
export const TaskIdsInit = () => {
  return new TaskIdsModal(StageIdsInit(), StageIdsInit());
};
const testFieldData = new FieldContentData(9, "template.txt", StageIdsInit());
testFieldData.stageIds.stopping.push(11, 12);
export const fieldTreeInit = new FieldTree(
  [new FieldIdData(6, [new FieldIdData(7, []), new FieldIdData(8, [new FieldIdData(9, [])])])],
  [
    new FieldContentData(6, "文件夹", StageIdsInit()),
    new FieldContentData(7, "空的", StageIdsInit()),
    new FieldContentData(8, "我的文件", StageIdsInit()),
    testFieldData,
  ],
);
export const stagePath = "./data/stage.json";
const testStageModal = new StageData(12, "第2个阶段", 0, 9);
testStageModal.task.TaskBased.onGonging.push(13, 14);
export const stageInit = new StageList([new StageData(11, "第一个阶段", 0, 9), testStageModal]);

export const taskPath = "./data/task.json";
export const taskInit = new TaskList([
  new TaskData(
    13,
    "第一个任务",
    1,
    12,
    "",
    TimeMentionModal.setTaskBased(new TimeMentionModal(), new Date().getTime(), 0, 1),
  ),
  new TaskData(
    14,
    "第2个任务",
    1,
    12,
    "",
    TimeMentionModal.setTaskBased(new TimeMentionModal(), new Date().getTime(), 0, 1),
  ),
]);

export const taskLogPath = "./data/taskLog/";
export const mardDownPath = "./mardDown/";
export const picPath = "./pic/";
export const statisticPath = "./statistic/";
export const memoryPath = "./memory/";
export const finishStagePath = "./data/finishStage/";

export function getInitPath(): Array<Array<string | object>> {
  return [
    [surfaceSettingPath, surfaceSettingInit],
    [lifeModelPath, lifeModelInit],
    [timeManagePath, timeManageInit],
    [fieldTreePath, fieldTreeInit],
    [stagePath, stageInit],
    [taskPath, taskInit],
  ];
}
